package org.example.service.impl;

import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.asymmetric.SM2;
import org.example.model.User;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

/**
 *
 * @author 程序员阿乐
 * @description
 * @createDate 2025/3/24 09:17
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Override
    public Integer login(User user) {
        // 参数校验
        if (user == null || user.getUsername() == null || user.getPassword() == null) {
            return -1;
        }
        // 验证密码
        passwordEncoder.matches(user.getPassword(),"123456");
        return 1;

    }

    @Override
    public Integer save(User user) {

        return 1;
    }
}
